/* 
 * Copyright 2014 ShangDao.Ltd  All rights reserved.
 * SiChuan ShangDao.Ltd PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * 
 * @CardDetailAdapter.java  2014-9-10 上午11:12:21 - Carson
 * @author Guzhu
 * @email:muyi126@163.com
 * @version 1.0
 */

package com.android.tiango.baba.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.android.scsd.tiango.R;
import com.android.tiango.baba.util.ImageLoader;

public class CardDetailAdapter extends BaseAdapter {
	private Context context;
	private List<String> list=new ArrayList<String>();
	private ImageLoader mLoader;

	public CardDetailAdapter(Context context) {
		this.context = context;
		mLoader = new ImageLoader(context, R.drawable.ic_default);
	}

	
	public void setData( List<String> list){
		this.list = list;
	}
	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if (null == convertView) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(R.layout.item_pic, null);
			holder.iv_pic = (ImageView) convertView.findViewById(R.id.iv_pic);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		mLoader.loadImage(list.get(position), holder.iv_pic);
		// holder.iv_pic.setBackgroundResource(R.drawable.ic_home_center);
		return convertView;
	}

	class ViewHolder {
		private ImageView iv_pic;
	}
}
